<?php
/**
 * 默认接口服务类
 *
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */

class Api_FirstAddTips extends PhalApi_Api {

	public function getRules() {
        return array(
           'getTip'=>array(
			   'tip_id'=>array('name'=>'TipId'),
		   ),
			'setTip'=>array(
				'tip_id'=>array('name'=>'TipId'),
				'tip'=>array('name'=>'Tip')
			)
        );
	}
	/**
	     * 获取急救常识
	     * @desc 获取急救常识
	     * @return int code 操作码，0表示成功， 1错误
	     * @return object info 信息对象
	     * @return string msg 提示信息
	     */
	public function getTip() {
	        $rs = array('code' => 0, 'msg' => '', 'info' =>array('a'=>1));

	        $domain = new Domain_FirstAddTips();
	        $info = $domain->getTips($this->tip_id);


	        if (empty($info)) {
	            DI()->logger->debug('getTip()','');

	            $rs['code'] = 1;
	            $rs['msg'] = T('获取急救常识失败');
	            return $rs;
	        }

	        $rs['info'] = $info;
	        DI()->logger->debug('info of getTips()', $rs);

	        return $rs;

	    }
	/**
	     * 添加修改Tips
	     * @desc 添加修改Tips
	     * @return int code 操作码，0表示成功， 1错误
	     * @return object info 信息对象
	     * @return string msg 提示信息
	     */
	public function setTip() {
	        $rs = array('code' => 0, 'msg' => '', 'info' =>array('a'=>1));

	        $domain = new Domain_FirstAddTips();
	        $info = $domain->setTips($this->tip_id ,$this->tip);

	        if (empty($info)) {
	            DI()->logger->debug('setTips','');

	            $rs['code'] = 1;
	            $rs['msg'] = T('添加修改Tips失败');
	            return $rs;
	        }

	        $rs['info'] = $info;
	        DI()->logger->debug('info of setTips', $rs);

	        return $rs;

	    }
	

}